home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _COLORCH.PRG < prev    next >
Text File  |  1993-05-04  |  3KB  |  93 lines

  1. FUNCTION _ColorChk
  2. PARAMETERS pc_WhichCo
  3. *---------------------------------------------------------------------
  4. * NAME
  5. *   _ColorChk - Return a specific color attribute setting.
  6. *
  7. * SYNOPSIS
  8. *   _ColorChk( pc_WhichCo )
  9. *
  10. * DESCRIPTION
  11. *   _ColorChk() returns a string representing one of eight
  12. *   possible color attribute values.  The first letters of
  13. *   the argument string mean the following.  (These are listed
  14. *   in the same order as they are returned by SET("ATTRIBUTES".
  15. *   Upper or lower case may be used.)
  16. *
  17. *   "N" - Normal.
  18. *   "H" - Highlight.
  19. *   "P" - Perimeter.
  20. *   "M" - Messages.
  21. *   "T" - Titles.
  22. *   "B" - Box.
  23. *   "I" - Information.
  24. *   "F" - Fields.
  25. *
  26. *   The string returned is of the pattern: <foreground/background>.
  27. *   Letters are used to represent specific colors.  For example,
  28. *   the string "W+/B" indicates bright white on blue.  The dBASE IV
  29. *   documentation includes detailed explanation of these codes.
  30. *
  31. * NOTE
  32. *   Since only the first letter of the argument is used, the
  33. *   full words can be used for greater code readability.  Thus,
  34. *   the following three sample lines of code are identical:
  35. *
  36. *     lc_fldclr = _ColorChk( "f" )
  37. *     lc_fldclr = _ColorChk( "FIELDS" )
  38. *     lc_fldclr = _ColorChk( "Fuzzy wuzzy" )
  39. *
  40. * PARAMETERS
  41. *   pc_WhichCo = The single letter or string indicating which color
  42. *                attribute string to return.
  43. *
  44. * LIMITATIONS
  45. *   _ColorChk() does not test for valid arguments.
  46. *   An argument starting with a letter other than the eight
  47. *   listed above will return the Normal color setting string.
  48. *
  49. * SEE ALSO:
  50. *   SET("ATTRIBUTES"), SET COLOR
  51. *
  52. *---------------------------------------------------------------------
  53.  
  54.   PRIVATE lc_colattr, lc_whichco, ln_count, ln_stop_at, lc_attrib
  55.  
  56.   lc_whichco = UPPER(LEFT(pc_whichco,1))
  57.   lc_attrib  = SET("ATTRIBUTE")
  58.  
  59.   IF lc_whichco $ "MTBIF"
  60.     lc_colattr = SUBSTR(lc_attrib, AT("&", lc_attrib) + 2)
  61.   ELSE
  62.     lc_colattr = LEFT(lc_attrib, AT("&", lc_attrib) - 2)
  63.   ENDIF
  64.  
  65.   DO CASE
  66.     CASE lc_whichco = "F"
  67.       ln_stop_at = 4
  68.     CASE lc_whichco = "I"
  69.       ln_stop_at = 3
  70.     CASE lc_whichco $ "BP"
  71.       ln_stop_at = 2
  72.     CASE lc_whichco $ "TH"
  73.       ln_stop_at = 1
  74.     OTHERWISE
  75.       ln_stop_at = 0
  76.   ENDCASE
  77.  
  78.   ln_count = 1
  79.  
  80.   DO WHILE m->ln_count <= m->ln_stop_at
  81.     lc_colattr = SUBSTR(m->lc_colattr, AT(",", m->lc_colattr) + 1)
  82.     ln_count = m->ln_count + 1
  83.   ENDDO
  84.  
  85. RETURN IIF("," $ lc_colattr, ;
  86.             LEFT(lc_colattr, AT(",", lc_colattr) - 1), ;
  87.             lc_colattr ;
  88.           )
  89. *-- EOF:  _ColorChk( pc_WhichCo )
  90.  
  91.  
  92.  
  93.